﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 语音测试工具
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            /*using (SpeechSynthesizer speechSyn = new SpeechSynthesizer())
            {
                speechSyn.Speak("你好，我是语音测试工具！");
            }*/
            SpeechSynPlay();
        }

        private void SpeechSynPlay() {
            SpeechSynthesizer speechSyn = new SpeechSynthesizer();
             var currentSpokenPrompt = speechSyn.GetCurrentlySpokenPrompt();
             if (currentSpokenPrompt != null)
             {
                 speechSyn.SpeakAsyncCancel(currentSpokenPrompt);
             }
             speechSyn.SpeakAsync("你好，我是语音测试工具！");
        }
        
    }
}
